package com.yc.cloud.openai.portal.factory;

import java.util.EnumMap;
import java.util.Map;

import org.springframework.stereotype.Component;

import com.yc.cloud.openai.portal.dao.ComfyUiClient;
import com.yc.cloud.openai.portal.enums.TextToImageProvider;

@Component
public class TextToImageClientFactory {

    private final Map<TextToImageProvider, ComfyUiClient> clientMap = new EnumMap<>(TextToImageProvider.class);

    public TextToImageClientFactory(Map<String, ComfyUiClient> clientBeans) {
        // 使用枚举的 value 作为键来初始化 Map
        clientBeans.forEach((name, client) -> clientMap.put(TextToImageProvider.valueOf(name), client));
    }

    public Map<TextToImageProvider, ComfyUiClient> getClientMap() {
        return clientMap;
    }
}
